LFX Phase 2: Parameter taxonomy and LLM prompt architecture#1766
Open
ishaan-arora-1 wants to merge 4 commits intoriscv:mainfrom
Open
LFX Phase 2: Parameter taxonomy and LLM prompt architecture#1766ishaan-arora-1 wants to merge 4 commits intoriscv:mainfrom
ishaan-arora-1 wants to merge 4 commits intoriscv:mainfrom
Conversation
…tion Add scripts and data for cataloging all 185 UDB architectural parameters with schema analysis, CSR cross-references, heuristic classifications, and candidate spec text locations. This forms the foundation for LLM-based parameter extraction from the RISC-V specification. Scripts: - export_udb_params.py: extracts parameters from YAML, derives value types, cross-references CSR IDL, classifies each parameter - map_params_to_spec.py: searches 74 spec .adoc files for text related to each parameter using multi-strategy keyword matching - generate_report.py: produces CSV catalog, text report, and param name list Key results: - 185 parameters cataloged (102 NORM_DIRECT, 55 NORM_CSR_RW, 26 NORM_CSR_WARL, 2 SW_RULE) - 81% high-confidence classifications - 98% of parameters mapped to spec text candidates Closes riscv#1747
Design and implement the formal parameter classification taxonomy and prompt architecture for LLM-based extraction from RISC-V specifications. Deliverables: - taxonomy.md: formal definitions for 8 parameter classes (NORM_DIRECT, NORM_CSR_WARL, NORM_CSR_RW, SW_RULE, NON_ISA, NON_NORM, DOC_RULE, UNKNOWN) with disambiguation rules and a decision tree - system_prompt.txt: ~940 token system prompt defining role, task, taxonomy, critical rules, and JSON output schema - examples.json: 6 positive + 4 negative few-shot examples from real spec text covering all normative classes and key false-positive patterns (NOTE blocks, CSR behavior, fixed requirements, permission vs optionality "may") - run_prompt.py: prompt assembler with 3 CLI modes (assemble, chunk, estimate) supporting context window management across models - validate_prompt.py: 175-check validation suite for all deliverables Key design decisions: - Single-pass extraction + classification to preserve context - Mandatory reasoning field in LLM output to reduce hallucinations - Section-boundary-aware chunking with configurable overlap - Three-layer prompt: system + examples + param names + spec chunk Closes riscv#1748
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1766 +/- ##
=======================================
Coverage 71.96% 71.96%
=======================================
Files 54 54
Lines 27976 27976
Branches 6183 6183
=======================================
Hits 20132 20132
Misses 7844 7844
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- Add REUSE annotation for param_extraction/** in REUSE.toml - Fix ruff lint errors: remove unused variables, prefix unused loop vars with underscore, remove extraneous f-string prefixes, remove unused imports, sort import blocks - Apply ruff formatting to all Python scripts - Make Python scripts executable to satisfy EXE001 shebang check - Fix prettier formatting for ground_truth.json and spec_mappings.json - Strip trailing whitespace from parameters_catalog.csv - Add missing end-of-file newline to phase1_report.txt
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Design and implement the formal parameter classification taxonomy and LLM prompt architecture for extracting architectural parameters from the RISC-V specification. Builds on Phase 1 (#1765).
taxonomy.md): 8 parameter classes with precise definitions, disambiguation rules, and a decision treesystem_prompt.txt): ~940 token prompt defining role, task, condensed taxonomy, critical rules, and strict JSON output schemaexamples.json): 6 positive + 4 negative examples from real spec text covering all normative classification classes and key false-positive patternsrun_prompt.py): CLI tool with 3 modes —assemble,chunk, andestimate— for building context-aware prompts across different LLM modelsvalidate_prompt.py): 175-check automated verification covering taxonomy completeness, example accuracy, schema consistency, assembly correctness, and chunking integrityKey Design Decisions
reasoningfield in outputskipped_non_parametersin outputParameter Classes
NORM_DIRECTNORM_CSR_RWNORM_CSR_WARLSW_RULENON_ISANON_NORMDOC_RULEUNKNOWNToken Budget
How to Run
Test Plan
validate_prompt.pypasses 175/175 checks (0 failures)ground_truth.jsonValueErrorfor small-context modelsCloses #1748